using System;
using System.Collections.Generic;
using Me.Prettyprint.Cassandra.Model;
using Me.Prettyprint.Cassandra.Model.Thrift;
using Me.Prettyprint.Cassandra.Service;
using Me.Prettyprint.Cassandra.Utils;
using Me.Prettyprint.Hector.Api;
using Me.Prettyprint.Hector.Api.Factory;
using Me.Prettyprint.Hector.Api.Mutation;
using Thrift;

namespace Me.Prettyprint.Cassandra.Service.Template
{
    /// <summary>
    /// Factory to remove Cassandra configuration concerns from DAO objects. 
    /// In Java, this is invoked via a spring factory method that allows
    /// injection of the Hector Cluster object into the DAO. For .Net it
    /// might be useful.
    /// </summary>
	public class CassandraClusterFactory
	{
		internal static readonly Logger log = new Logger(typeof(CassandraClusterFactory));
		
		public static Cluster GetInstance(string name, string host, int port)
		{
			log.Info("getInstance: creating cluster name=" + name + ", host=" + host + ", port=" + port);
			return HFactory.GetOrCreateCluster(name, host + ":" + port);
		}
	}
}